
package cartagows.wsframework.wssecurity.policy.model;

import cartagows.wsframework.wssecurity.policy.SPConstants;

public abstract class Token extends AbstractSecurityAssertion {


    private int inclusion = SPConstants.INCLUDE_TOEKN_ALWAYS;   
    private boolean derivedKeys;   
    private boolean impliedDerivedKeys;   
    private boolean explicitDerivedKeys;

    public int getInclusion() {
        return inclusion;
    }

    public void setInclusion(int inclusion)  {
        if(SPConstants.INCLUDE_TOEKN_ALWAYS == inclusion || 
           SPConstants.INCLUDE_TOEKN_ALWAYS_TO_RECIPIENT == inclusion ||
           SPConstants.INCLUDE_TOEKN_ALWAYS_TO_INITIATOR == inclusion ||
           SPConstants.INCLUDE_TOKEN_NEVER == inclusion ||
           SPConstants.INCLUDE_TOKEN_ONCE == inclusion ) {
            this.inclusion = inclusion;
        } else {
            //TODO replace this with a proper (WSSPolicyException) exception
            throw new RuntimeException("Incorrect inclusion value: " + inclusion);
        }
    }
    
    public boolean isDerivedKeys() {
        return derivedKeys;
    }

    public void setDerivedKeys(boolean derivedKeys) {
        this.derivedKeys = derivedKeys;
    } 
    
    public boolean isExplicitDerivedKeys() {
        return explicitDerivedKeys;
    }
    
    public void setExplicitDerivedKeys(boolean explicitDerivedKeys) {
        this.explicitDerivedKeys = explicitDerivedKeys;
    }
    
    public boolean isImpliedDerivedKeys() {
        return impliedDerivedKeys;
    }
    
    public void setImpliedDerivedKeys(boolean impliedDerivedKeys) {
        this.impliedDerivedKeys = impliedDerivedKeys;
    }
    
}